#ifndef CONNECTMNG_H
#define CONNECTMNG_H

#include <QObject>
#include <QMap>
#include <dbconnection.h>

class ConnectMng : public QObject
{
    Q_OBJECT
public:
    explicit ConnectMng(QObject *parent = nullptr);

    ConnectMng(ConnectMng&)=delete;
    ConnectMng& operator=(const ConnectMng&)=delete;

    QMap<QString, DBConnection> getDBConnMap();

    void createConnection(DBConnection conn);
    void deleteConnection(QString name);
    void editConnection(DBConnection conn);
    bool isSupported(int type);


    static ConnectMng& getInstance(){
        static ConnectMng instance;
        return instance;
    }

    enum DBTYPE {TDENGINE, POSTGRESQL, REDIS};

signals:
    void connCreated(DBConnection conn);
    void connDeleted(QString name);
    void connEditted(DBConnection conn);
private:
    QMap<QString, DBConnection> m_connMap;

};

#endif // CONNECTMNG_H
